import 'package:earclean/app/modules/table/controllers/table_controller.dart';
import 'package:earclean/app/modules/widget/login_button.dart';
import 'package:earclean/app/routes/app_pages.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/src/size_extension.dart';
import 'package:get/get.dart';

class MangDialogView extends StatelessWidget {
  final String title;
  const MangDialogView({required this.title});

  @override
  Widget build(BuildContext context) {
    return UnconstrainedBox(
      child: Container(
          width: 1.sw - 50,
          height: 170,
          decoration: BoxDecoration(
              color: Colors.white,
              borderRadius: BorderRadius.all(Radius.circular(10.r))),
          child: Stack(
            children: [
              Positioned.fill(
                child: Column(
                  children: [
                    SizedBox(
                      height: 50,
                    ),
                    Container(
                      padding: EdgeInsets.symmetric(horizontal: 15),
                      child: Text(title,
                          style: TextStyle(
                              fontSize: 16.sp,
                              color: Color(0xFF606972),
                              fontWeight: FontWeight.w500)),
                    ),
                    SizedBox(
                      height: 23,
                    ),
                    Container(
                      height: 45,
                      width: 265.w,
                      child: SizedBox(
                        child: LoginButton(
                          "好的",
                          enable: true,
                          onPressed: () {
                            Get.until(
                                (route) => route.settings.name == Routes.TABLE);
                            Get.find<TableController>().changePage(1);
                          },
                        ),
                      ),
                    )
                  ],
                ),
              ),
              Positioned(
                  top: 15,
                  right: 15,
                  child: InkWell(
                    onTap: () {
                      Get.back();
                    },
                    child: Image.asset(
                      'assets/images/tab-关闭.png',
                      width: 20.r,
                    ),
                  ))
            ],
          )),
    );
  }
}
